<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue 3 计算属性示例</title>
    <script src="../libs/vue.global.min.js"></script>
</head>

<body>
    <!-- 定义 Vue 应用的挂载点 -->
    <div id="app">
        <label for="firstName">姓：</label>
        <input type="text" id="firstName" v-model="firstName">
        <label for="lastName">名：</label>
        <input type="text" id="lastName" v-model="lastName">
        <p>全名：{{ fullName }}</p>
    </div>

    <script>
        const { createApp } = Vue;
        const app = createApp({
            data() {
                return {
                    firstName: '',
                    lastName: ''
                };
            },
            computed: {
                fullName() {
                    return this.firstName + ' ' + this.lastName;
                }
            }
        });

        // 挂载应用到 DOM 节点
        app.mount('#app');
    </script>
</body>

</html>